

<?php

include_once(dirname(__FILE__).'/../database/Month.php');
include_once(dirname(__FILE__).'/../database/dbMonth.php');

class testdbMonths extends UnitTestCase {
	
      function testdbMonthsModule() {
       
        //creates an empty dbMonth table
                $this->assertTrue(setup_dbMonth());
               
        // create a month to add to the database
        $m = new Month("06-01-10", "One", "unpublished");
       
        // test the insert function
        $this->assertTrue(insert_dbMonth($m));
       
        // test the select function
        $this->assertEqual(select_dbMonth($m->get_id())->get_id(), "06-01-10");
        $this->assertEqual(select_dbMonth($m->get_id())->get_status(), "unpublished");
        $this->assertEqual(select_dbMonth($m->get_id())->get_group(), "One");
        $this->assertEqual(select_dbMonth($m->get_id())->get_end_of_month_timestamp(), $m->get_end_of_month_timestamp());
       
        // test the update function
        $m->set_status("published");
        $this->assertTrue(update_dbMonth($m));
        $this->assertEqual(select_dbMonth($m->get_id())->get_status(), "published");
       
        // tests the delete function
        $this->assertTrue(delete_dbMonth($m->get_id()));
        echo("\ntestdbMonths complete\n");
      }
}
